package com.kizuki.springcloud.controller;

import com.kizuki.springcloud.pojo.Dept;
import com.kizuki.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class DeptConsumerController {

    @Autowired
    private DeptClientService deptClientService;

    @RequestMapping("/consumer/dept/add")
    private boolean addDept(Dept dept) {
        return deptClientService.addDept(dept);
    }

    @RequestMapping("/consumer/dept/list")
    private List<Dept> queryDepts() {
        return deptClientService.queryDepts();
    }

    @RequestMapping("/consumer/dept/get/{id}")
    private Dept queryDeptById(@PathVariable("id") int id){
        return deptClientService.queryDeptById(id);
    }


}
